function hilite(o){
	var content = "";
	color = "black";
	switch(o.name.toString()){
	case "name":
		content = "请填写名称";
		break;
	case "phone":
		content = "请填写电话";
		break;
	case "image":
		content = "请选择要上传的图片";
		break;
	case "password":
		content = "请填写密码";
		break;
	case "deadline":
		content = "请选择日期";
	}
	obj = document.getElementById(o.name.toString()+"_ts");
	obj.innerHTML = content;
	obj.color = color;
}

function delite(o){;
	var content = "√";
	var color = "green";
	var value = o.value.toString();
	var Regx = /^[A-Za-z0-9]*$/;
	var RegxPhone = /^1[3|5|7|8|][0-9]{9}$/;
	if(value.trim() == ""){
		content = "不能为空";
		color = "red";
	}
	obj = document.getElementById(o.name.toString()+"_ts");
	obj.color = color;
	obj.innerHTML = content;
	if(color == "red"){
		return false;
	}else{
		return true;
	}
}


document.onkeydown = function(e){
	e = e ? e : window.event;
	var keyCode = e.which ? e.which : e.keyCode;
	if(keyCode == 13)
	{
		submitBtn();
	}
}

function submitBtn(){
	var input = document.getElementsByTagName("input");
	var isOk = true;
	for(var i=0;i<input.length;i++){
		if(input[i].type != "button" && input[i].name != "gender"){
			var isOk2 = delite(input[i]);
			if(isOk){
				isOk = isOk2;
			}
		}
	}
	if(isOk ){
		document.getElementById("form_addScenic").submit();
	}

}
